package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.data.BaseData;
import com.cskaoyan.bean.issue.IssueCreateBO;
import com.cskaoyan.bean.keyword.CreateKeywordBO;
import com.cskaoyan.bean.keyword.CreateKeywordVO;
import com.cskaoyan.bean.keyword.KeywordListUnitVO;
import com.cskaoyan.bean.keyword.KeywordReq;
import com.cskaoyan.service.KeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: whyccz-mall-project
 * @description:
 * @create: 2021-06-06 22:24
 **/
@RestController
@RequestMapping("admin/keyword")
public class AdminKeywordController {
	@Autowired
	KeywordService keywordService;


	@RequestMapping("list")
	public BaseRespVo keywordList(KeywordReq keywordReq){
		BaseData<KeywordListUnitVO> keywordList= keywordService.selectKeywordList(keywordReq);
		return BaseRespVo.ok(keywordList);
	}

	@RequestMapping("create")
	public BaseRespVo keywordCreate(@RequestBody CreateKeywordBO createKeywordBO){
		CreateKeywordVO keywordVO=keywordService.createKeyword(createKeywordBO);
		return BaseRespVo.ok(keywordVO);
	}

	@RequestMapping("update")
	public BaseRespVo keywordUpdate(@RequestBody CreateKeywordVO keywordVO){
		CreateKeywordVO keywordUpdate= keywordService.updateIssue(keywordVO);
		return BaseRespVo.ok(keywordUpdate);
	}

	@RequestMapping("delete")
	public BaseRespVo keywordDelete(@RequestBody CreateKeywordVO keywordDeleteVO){
		keywordService.deleteIssue(keywordDeleteVO);
		return BaseRespVo.ok();
	}
}
